Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC about certificate handling #24

Merged
merged 3 commits into from
Sep 26, 2023
Merged

Conversation

flavio
Copy link
Member

@flavio flavio commented Aug 11, 2023

This RFC describes the current state of certificate handling inside of Kubewarden and how this should be extended.

@flavio flavio marked this pull request as draft August 11, 2023 12:41
@flavio flavio self-assigned this Aug 11, 2023
Adding RFC that describes how certificate handling should be done inside
of the KW project.

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
@flavio flavio changed the title WIP: write RFC about certificate handling RFC about certificate handling Sep 1, 2023
@flavio flavio marked this pull request as ready for review September 1, 2023 12:52
Copy link
Member

@viccuad viccuad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ratified, just some small typo suggestions.

Co-authored-by: Víctor Cuadrado Juan <2196685+viccuad@users.noreply.github.com>
Signed-off-by: Flavio Castelli <flavio@castelli.me>
Copy link
Member

@jvanz jvanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I just have quick questions... ;)

Comment on lines +92 to +97
## Proposed Design

We would like to get rid of CertManager. To do that we need to change how certificates are
managed for the `kubewarden-controller`.
Going forward, the controller will also take care of generating the certificate used by the kubewarden-controller.
This certificate is going to be signed by the CA which is already created by the controller.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we remove it completely or make it optional? I would like to double check that because the original issue around this topic says to turn it optional

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree on having it optional, and disabled by default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the advantage of having this certificate generated by CertManager? I mean, we're still generating all the internal ones by ourselves.

I would prefer to drop the CertManager dependency entirely, just to reduce the support matrix and keep the code as simple as possible

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flavio does this comment still stand? I thought we wanted to still support cert-manager, but not as default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last week @jvanz, @fabriziosestito and agreed to focus on removing the cert-manager dependency. We can make it optional in the future if there's some request coming from the community.

Comment on lines +199 to +200
The reconciliation loop is also triggered every X seconds as a way to cope with possible glitches
with the event notification system.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this time based trigger setup? Is this done by kube-builder? I cannot see this in the code. =(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, we're currently using controller-runtime version 0.14.6.

When creating the Manager we give to it some configuration Options, see here

One of the values of the Manager Options is called SyncPeriod. Since we don't specify anything, we will have an automatic sync interval of 10 hours. Meaning, even if there's no event affecting one of our watched resources, we will still have a sync every 10 hours.

This configuration parameter has been moved to another location inside of the latest release of controller-runtime. Now this is one of the configuration values of the cache. The behaviour stays the same: every 10 hours you get a full sync.

We can rely on this 10 hours sync or we could be more explicit inside of our reconciliation loops by returning a reconcile.Result{RequeueAfter: t} instead of a reconcile.Result{}.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably go with the latter. As the docstring states, we shouldn't change the SyncPeriod as it forces every object in the cache to be reconciled, and we might need a shorter window than 10 hours. Not a strong opinion, though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would either leave things untouched, hence rely on the default sync value, or provide an explicit sync timer via the Result response

Copy link
Contributor

@fabriziosestito fabriziosestito Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably go with the latter.

Sorry I did not explain myself well, I meant that I have a small preference for the Result solution.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, that was clear to me. I also share the same feeling about how to move forward.

This change (being explicit about the sync time) should be tracked with a dedicated issue, which would be unrelated to this RFC

Now we know how to handle the renewal of the internal root CA.

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
@flavio flavio merged commit bc441fd into kubewarden:main Sep 26, 2023
1 check passed
@flavio flavio deleted the certificate-handling branch September 26, 2023 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants